#%RAML 1.0
title: Location API
version: v3.0
protocols: [ HTTP, HTTPS ]
baseUri: http://github.com/org/folio/mod-inventory-storage

documentation:
  - title: Locations API
    content: This documents the API calls that can be made to query and manage
      (shelf) locations of the system

types:
  location: !include location.json
  locations: !include locations.json
  errors: !include raml-util/schemas/errors.schema

traits:
  pageable: !include raml-util/traits/pageable.raml
  searchable: !include raml-util/traits/searchable.raml
  language: !include raml-util/traits/language.raml
  validate: !include raml-util/traits/validation.raml

resourceTypes:
  collection: !include raml-util/rtypes/collection.raml
  collection-item: !include raml-util/rtypes/item-collection.raml
  get-delete-only: !include raml-util/rtypes/get-delete.raml

/locations:
  type:
    collection:
      exampleCollection: !include examples/locations.json
      exampleItem: !include examples/location.json
      schemaCollection: locations
      schemaItem: location
  get:
    is: [
      searchable: {description: "with valid searchable fields", example: "name=aaa"},
      pageable
    ]
    description: Return a list of locations
  post:
    description: Create a new location
    is: [validate]
  delete:
    is: [language]
    description: "Delete all locations"
    responses:
      204:
        description: "All locations deleted"
      500:
        description: "Internal server error, e.g. due to misconfiguration"
        body:
          text/plain:
            example: "Internal server error, contact administrator"
  /{id}:
    description: "Pass in the  location id"
    type:
      collection-item:
        exampleItem: !include examples/location.json
        schema: location
    get:
    put:
      description: Update a location by id
      is: [validate]
    delete:
